package com.xo.xodemo.util;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class TomorrowUtil {
    /**
     * 获取明天的日期字符串
     * @return
     */
    public static String tomorrowDateStr(){
        Date date=new Date();//取时间
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        //把日期往后增加一天.整数往后推,负数往前移动
        calendar.add(Calendar.DATE,1);

        //这个时间就是日期往后推一天的结果
        date=calendar.getTime();

        SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
        String tomorrowStr = formatter.format(date);
        return tomorrowStr;
    }
    public static String halfHourStr(){
        Date date=new Date();//取时间
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        //把日期往后增加半小时
        calendar.add(Calendar.MINUTE,30);
        date=calendar.getTime();

        SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
        String tomorrowStr = formatter.format(date);
        return tomorrowStr;
    }
}